package com.ruoyi.baselibrary.infobasespecialist.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.baselibrary.infobasespecialist.domain.InfoBaseSpecialistFile;
import com.ruoyi.baselibrary.infobasespecialist.mapper.InfoBaseSpecialistFileMapper;
import com.ruoyi.baselibrary.infobasespecialist.service.IInfoBaseSpecialistFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 专家附件Service业务层处理
 *
 * @author ruoyi
 * @date 2022-01-13
 */
@Service
public class InfoBaseSpecialistFileServiceImpl implements IInfoBaseSpecialistFileService {
    @Autowired
    private InfoBaseSpecialistFileMapper infoBaseSpecialistFileMapper;

    /**
     * 查询专家附件
     *
     * @param id 专家附件主键
     * @return 专家附件
     */
    @Override
    public InfoBaseSpecialistFile selectInfoBaseSpecialistFileById(Long id) {
        return infoBaseSpecialistFileMapper.selectInfoBaseSpecialistFileById(id);
    }

    /**
     * 查询专家附件列表
     *
     * @param infoBaseSpecialistFile 专家附件
     * @return 专家附件
     */
    @Override
    public List<InfoBaseSpecialistFile> selectInfoBaseSpecialistFileList(InfoBaseSpecialistFile infoBaseSpecialistFile) {
        return infoBaseSpecialistFileMapper.selectInfoBaseSpecialistFileList(infoBaseSpecialistFile);
    }

    /**
     * 新增专家附件
     *
     * @param infoBaseSpecialistFile 专家附件
     * @return 结果
     */
    @Override
    public int insertInfoBaseSpecialistFile(InfoBaseSpecialistFile infoBaseSpecialistFile) {
        infoBaseSpecialistFile.setCreateTime(DateUtils.getNowDate());
        infoBaseSpecialistFile.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
        return infoBaseSpecialistFileMapper.insertInfoBaseSpecialistFile(infoBaseSpecialistFile);
    }

    /**
     * 修改专家附件
     *
     * @param infoBaseSpecialistFile 专家附件
     * @return 结果
     */
    @Override
    public int updateInfoBaseSpecialistFile(InfoBaseSpecialistFile infoBaseSpecialistFile) {
        infoBaseSpecialistFile.setUpdateTime(DateUtils.getNowDate());
        infoBaseSpecialistFile.setCreateBy(SecurityUtils.getLoginUser().getUser().getNickName());
        return infoBaseSpecialistFileMapper.updateInfoBaseSpecialistFile(infoBaseSpecialistFile);
    }

    /**
     * 批量删除专家附件
     *
     * @param ids 需要删除的专家附件主键
     * @return 结果
     */
    @Override
    public int deleteInfoBaseSpecialistFileByIds(Long[] ids) {
        return infoBaseSpecialistFileMapper.deleteInfoBaseSpecialistFileByIds(ids);
    }

    /**
     * 删除专家附件信息
     *
     * @param id 专家附件主键
     * @return 结果
     */
    @Override
    public int deleteInfoBaseSpecialistFileById(Long id) {
        return infoBaseSpecialistFileMapper.deleteInfoBaseSpecialistFileById(id);
    }
}
